import type {
  EntityApi,
  EntityReq,
  EntityModel,
  EntityList,
  EntityPage,
  EntityTotal,
  EntityKey,
  EntityKeyList,
  EntityCreateReq,
  EntityUpdateReq,
  EntityExportReq
} from "@/api/types";

//层级字典实体接口
export interface DictLayEntryApi extends EntityApi {}

//层级字典实体查询
export interface DictLayEntryReq extends EntityReq {
  //字典类型编码
  typeCode?: string;
  //字典编码
  dictCode?: string;
  //字典父ID
  parentId?: string;
  //深度
  depth?: number;
  //是否包含启用
  hasEnable?: boolean;
  //是否启用
  enable?: boolean;
}

//层级字典实体实体
export interface DictLayEntryModel extends EntityModel {
  //字典ID
  dictId: string;
  //字典类型编码
  typeCode: string;
  //字典编码
  dictCode: string;
  //字典名称
  dictName: string;
  //字典父ID
  parentId?: string;
  //深度
  depth?: number;
  //排序
  listOrder?: number;
  //是否启用
  enable: boolean;
  //描述
  description?: string;
  //创建时间
  children?: DictLayEntryModel[];
}

//层级字典实体列表
export interface DictLayEntryList extends EntityList {
  //内容
  results: Array<DictLayEntryModel>;
}

// 层级字典实体分页
export interface DictLayEntryPage extends EntityPage {
  //当前页内容
  results: Array<DictLayEntryModel>;
}

// 合计
export interface DictLayEntryModelTotal extends EntityTotal {
  //总记录数
  totalSize: number;
}

// 层级字典实体主键
export interface DictLayEntryKey extends EntityKey {
  // 租户
  tenant?: string;
  dictId?: string;
}

//层级字典实体List
export interface DictLayEntryKeyList extends EntityKeyList {
  // 租户
  tenant: string;
  dictId?: Array<string>;
}

// 层级字典实体新增实体
export interface DictLayEntryCreateReq extends EntityCreateReq {
  //字典ID
  dictId?: string;
  //字典类型编码
  typeCode?: string;
  //字典编码
  dictCode?: string;
  //字典名称
  dictName?: string;
  //字典父ID
  parentId?: string;
  //深度
  depth?: number;
  //排序
  listOrder?: number;
  //是否启用
  enable?: boolean;
  //描述
  description?: string;
}

// 层级字典实体修改实体
export interface DictLayEntryUpdateReq extends EntityUpdateReq {
  //字典ID
  dictId?: string;
  //字典类型编码
  typeCode?: string;
  //字典编码
  dictCode?: string;
  //字典名称
  dictName?: string;
  //字典父ID
  parentId?: string;
  //深度
  depth?: number;
  //排序
  listOrder?: number;
  //是否启用
  enable?: boolean;
  //描述
  description?: string;
}

export type DictLayEntryFormReq = DictLayEntryCreateReq | DictLayEntryUpdateReq;

//导出请求
export interface DictLayEntryExportReq extends EntityExportReq {
  //筛选条件
  req: DictLayEntryReq;
}

// 上移下移
export interface DictLayEntryMoveKey {
  // 租户
  tenant?: string;
  dictId?: string;
  up?: boolean;
}

// 启用/禁用
export interface DictLayEntryEnableKey {
  // 租户
  tenant?: string;
  dictId?: string;
  enable?: boolean;
}
